package org.despair2D.ui 
{
	import org.despair2D.renderer.sections.SectionManager;
	import org.despair2D.ui.core.IComponent;
	import org.despair2D.ui.puppet.IPuppet;
	import org.despair2D.ui.puppet.AnimePuppet;
	import org.despair2D.renderer.sections.Section;
	import org.despair2D.ui.events.InteractiveEvent;
	
	import org.despair2D.core.ns_despair;
	import org.despair2D.ui.supportClasses.AbstractButton;

	use namespace ns_despair;
	
	
public class SectionButton extends AbstractButton 
{
	
	public function SectionButton( classRef:* ) 
	{	
		this.setButtonSection(classRef)
	}
	
	
	
	
	/**
	 * 绑定的傀儡
	 */
	public function get bindingPuppet() : AnimePuppet
	{
		return m_anime;
	}

	
	public function get buttonSection() : String
	{
		return m_anime.section;
	}
	
	
	
	public function setButtonSection( classRef:* ) : void
	{
		var section:Section = SectionManager.getSectionBySWF(classRef)		
		if(!m_anime)
		{
			m_anime = this.createAnimePuppet(section.m_name, -1) as AnimePuppet
		}
		m_anime.section  =  section.m_name
		m_buttonSection  =  section
	}
	
	
	override ns_despair function recycle() : void
	{
		super.recycle();
		m_anime = null;
		m_buttonSection = null;
	}

	
	
	ns_despair var m_anime:AnimePuppet;
	
	ns_despair var m_buttonSection:Section;
	

}

}